<?php
    //产品配置项

    //视图判断
    $this_store     = Mage::app()->getStore()->getStoreId();
    if($this_store == 2) {
        $banner_img_url = $this->getSkinUrl('images/landing-page/holidays_menu/ru/');
    }else    {
        $banner_img_url = $this->getSkinUrl('images/landing-page/holidays_menu/en/');
    }

    $home_url    =  Mage::getBaseUrl();
    $data = Mage::helper('promoteevents')->getEvents('holiday_travelling_0720');
    $recommandProductsImgSize = '320';
    $productsImgSize = '190';
    //$product_sku_01 = $data->getRecommandProducts($recommandProductsImgSize);
    $product_sku_02 = $data->getProducts($productsImgSize);
    $page_nav       = $data->getCategoryTitle();

    /* slider config */
    $idJs = "em_minifilter_products_".md5(uniqid(rand()));    
    if ($this->getData('slider_unique_id'))
    $idJs = $this->getData('slider_unique_id');
    $this->idJs = $idJs;

    //$key1 = array_keys($product_sku_01);
    $key2 = array_keys($product_sku_02);
    $key  =array_merge ($key1,$key2);
    $landing_page_nav = array();
    foreach ($key2 as $value) {
        $landing_page_nav[] = $value;
    }
?>
<script type="text/javascript">
//<![CDATA[
    /*设置背景banner*/
    (function($) {  
        $('.em-header-style31').css("margin","0px");
        $('.em-wrapper-main').css({"position":"relative","background":"#ffe5ae"});
        $('.em-wrapper-main >div').css({"margin-top":"0","padding-top":"0"});
        var bane = '<div class="page_top_banner"><ul class="holidays_menu_banner"><li style="background: url(<?php echo $banner_img_url ?>summer_01.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_02.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_03.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_04.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_05.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_06.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_07.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_08.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_09.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_10.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_11.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_12.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_13.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_14.png) no-repeat top left;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_15.png) no-repeat top right;"></li><li style="background: url(<?php echo $banner_img_url ?>summer_16.png) no-repeat top left;"></li></ul></div>';        
        $('.em-wrapper-main > .container').before(bane);            
    })(jQuery); 
//]]>
</script>

<div class="landing-page holidays_menu">
    <div class="landing_page_banner"><p style="display: table;height: 848px;width: 100%"></p></div>
    <div class="landing_page_product">
        <div class="nav_landing_page" id="nav_holidays_menu">
            <ul>
                <a class="landing_page_first"><li></li></a>
                <?php foreach ($landing_page_nav as $val): ?>
                    <?php $nav_landing_page = str_replace(' ','_',str_replace  ("'","",str_replace  ("&","",trim($page_nav[$val])))); ?>
                <a href="#summer_nav_<?php echo $val; ?>" class="summer_nav_<?php echo $val; ?>"><li></li></a>
                <?php endforeach ?>
                <a href="#top" class="landing_page_end"><li></li></a>
            </ul>
        </div>
        <div class="landing_page_centent ">
            <div class="entry_product">
<?php foreach ($landing_page_nav as  $val): ?>
    <div class="<?php echo str_replace(' ','_',$page_nav[$val]); ?>">
    <?php if ($product_sku_02[$val]): ?>
        <?php $nav_landing_page = str_replace(' ','_',str_replace  ("'","",str_replace  ("&","",trim($page_nav[$val])))); ?>
        <a style="position:relative;bottom: 6rem;display: block;width: 100%;" name="summer_nav_<?php echo $val; ?>"></a>
        <div class="product_tments">
            <span style="background: url(<?php echo $banner_img_url ?>summer_nav_<?php echo $val; ?>.png) no-repeat top;background-size: 100% 100%;"></span>
        </div>
        <div class="product_content">

        <?php foreach ($product_sku_02[$val] as $_product): ?>
                <div class="em-item-slider" style="width: <?php echo $productsImgSize."px"; ?>;display: inline-block;">
                    <div class="products-grid">
                    <div class="item first" style="width: 100%">
                    <div class="product-item">
                        <?php //Mage::helper('promoteevents')->isDisplayLabels($_product['id']); ?> 
                        <div class="product-shop-top">
                        <a target="_blank" href="<?php echo $productUrl = $_product['url'] ?>" title="<?php echo $productName = $_product['name'] ?>" class="product-image ">
                            <img src="<?php echo $_product['thumbnail']; ?>" width="<?php echo $productsImgSize; ?>" alt="<?php echo $productName; ?>" />
                        </a>
                        <div class="em-element-display-hover bottom">          
                            <ul class="add-to-links">
                                <li><a href="<?php echo $_product['wishlist'] ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
                            </ul>
                        </div>
                        </div>
                        <div class="product-shop">
                            <div class="f-fix">
                                <!--product name-->
                                <h3 class="product-name"><a target="_blank" href="<?php echo $productUrl; ?>" title="<?php echo $productName ?>"><?php echo $productName; ?></a></h3>
                                <!--product price-->
                                <?php 
                                    $price = $_product['price'];
                                    $currencyPrice = $_product['currency_price'];
                                    $finalPrice = $_product['final_price'];
                                    $currencyFinalPrice = $_product['currency_final_price'];
                                ?>
                                <div class="product_price">
                                    <?php if ($price == $finalPrice): ?>
                                        <span class="price"><?php echo $currencyPrice; ?></span>
                                    <?php else : ?>
                                        <span class="prices"><?php echo $currencyPrice; ?></span>
                                        <span class="finalPrice"><?php echo $currencyFinalPrice; ?></span>
                                    <?php endif ?>
                                </div>
                                <!-- Current Stcok -->
                                <div class="current_stcok">
                                    <span>
                                        <?php echo $this->__('Qty.'); ?><?php echo $_product['qty']; ?>
                                    </span>
                                    <?php if ($price!= $finalPrice): ?>
                                        <?php 
                                            $price_stk = ($price-$finalPrice)/$price;
                                            $price_stks = number_format($price_stk,2);
                                            echo (Mage::app()->getStore()->getStoreId() == '2')?"Скидка ".$price_stks*100 . "%":$price_stks*100 . "% off";
                                        ?>
                                    <?php endif ?>
                                </div>
                                <!--Shop Now-->
                                <div class="em-btn-addto">
                                    <a target="_blank" href="<?php echo $productUrl ?>"><?php echo $this->__('Shop Now') ?></a>
                                </div>  
                            </div>
                        </div>
                        <?php if($_product['qty'] == 0): ?>
                            <div class="page_instock"></div>
                        <?php endif ?>
                    </div>
                    </div>
                    </div>
                </div>
        <?php endforeach ?>

        </div>
    <?php endif ?>
    </div>
<?php endforeach ?>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    //<![CDATA[
    jQuery(function($){
        /*导航条随窗口滚动显示*/
        var nav_landing_page = $(".landing_page_product").offset().top;
        $(window).scroll(function () {
            if ($(window).scrollTop() > nav_landing_page-230) {
                $(".nav_landing_page").addClass("nav_landing_pages");
            }else{
                $(".nav_landing_page").removeClass("nav_landing_pages");
            }
        });
        
        <?php foreach ($landing_page_nav as $val): ?>
           /* var this_class = "<?php echo str_replace(' ','_',trim($page_nav[$val])); ?>";
            var this_page_centent = $('.landing_page_centent .'+this_class).offset().top;
            if($(window).scrollTop() > this_page_centent){
                $(this).addClass('nav_landings').siblings().removeClass('nav_landings');
            } */         
        <?php endforeach ?>
    })

    //]]>
</script>




